# Copyright 2023 Ant Group Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@rules_proto//proto:defs.bzl", "proto_library")
load("//bazel:yacl.bzl", "yacl_cc_library", "yacl_cc_test")

package(default_visibility = ["//visibility:public"])

proto_library(
    name = "blackbox_service",
    srcs = ["blackbox_service.proto"],
)

yacl_cc_library(
    name = "blackbox_service_errorcode",
    hdrs = ["blackbox_service_errorcode.h"],
)

cc_proto_library(
    name = "blackbox_service_proto",
    deps = [
        ":blackbox_service",
    ],
)

proto_library(
    name = "blackbox_dummy_service",
    srcs = ["blackbox_dummy_service.proto"],
)

cc_proto_library(
    name = "blackbox_dummy_service_proto",
    deps = [
        ":blackbox_dummy_service",
    ],
)

yacl_cc_library(
    name = "blackbox_dummy_service_impl",
    srcs = ["blackbox_dummy_service_impl.cc"],
    hdrs = ["blackbox_dummy_service_impl.h"],
    deps = [
        ":blackbox_dummy_service_proto",
        ":blackbox_service_errorcode",
        ":blackbox_service_proto",
        "//yacl/base:exception",
        "@com_github_brpc_brpc//:brpc",
        "@com_google_absl//absl/strings",
    ],
)

yacl_cc_library(
    name = "mock_transport",
    hdrs = ["mock_transport.h"],
    deps = [
        ":blackbox_dummy_service_impl",
        "//yacl/base:exception",
        "@com_github_brpc_brpc//:brpc",
    ],
)

yacl_cc_test(
    name = "mock_transport_test",
    srcs = ["mock_transport_test.cc"],
    deps = [
        ":blackbox_service_proto",
        ":mock_transport",
        "//yacl/link/transport/blackbox_interconnect:blackbox_dummy_service_proto",
    ],
)
